package oop.core.entity;

import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;

import oop.core.skill.*;

public class OccupationLibrary {
	private static Map<String, Occupation> library = new HashMap<String, Occupation>();
	private static int numOccupations = 0;
	
	public static int getNumOccupations(){
		return numOccupations;
	}
	
	public static void init()
	{
		
		List<InteractiveSkill> sminteractiveSkills = new ArrayList<InteractiveSkill>();
		
		List<PassiveSkill> smpassiveSkills = new ArrayList<PassiveSkill>();
		
		smpassiveSkills.add(new PassiveSkill("OneHanded", 1));
		smpassiveSkills.add(new PassiveSkill("TwoHanded", 1));
		smpassiveSkills.add(new PassiveSkill("Brawling", 1));
		smpassiveSkills.add(new PassiveSkill("Observation", 1));
		smpassiveSkills.add(new PassiveSkill("Bargain", 1));
		
		List<ActiveSkill> smactiveSkills = new ArrayList<ActiveSkill>();
//		smactiveSkills.add(new Cone(true, "Fireball", 1, 1000L, 1, 5.0f, "fire", 1000L, 4, null, null));
		smactiveSkills.add(new Radial("Nuclear Bomb", 1, 500L, 1L, 5.0f, "skull", 500L, 5, null, null));
		
		library.put("Smasher", 
				new Occupation("Smasher", sminteractiveSkills, smpassiveSkills , smactiveSkills, 
						new Stats(0, 0, 0, 0, 10, 5, 2, 10 ,5) ) );
		
		List<InteractiveSkill> sninteractiveSkills = new ArrayList<InteractiveSkill>();
		
		sninteractiveSkills.add(new PickPocket("Pickpocket", 1));
		
		List<PassiveSkill> snpassiveSkills = new ArrayList<PassiveSkill>();
		
		snpassiveSkills.add(new PassiveSkill("Ranged", 1));
		snpassiveSkills.add(new PassiveSkill("DetectRemoveTrap", 1));
		snpassiveSkills.add(new PassiveSkill("Observation", 1));
		snpassiveSkills.add(new PassiveSkill("Bargain", 1));
		snpassiveSkills.add(new PassiveSkill("RemoveTrap", 20));
		
		List<ActiveSkill> snactiveSkills = new ArrayList<ActiveSkill>();
		
		library.put("Sneak", 
				new Occupation("Sneak", sninteractiveSkills, snpassiveSkills , snactiveSkills, 
						new Stats(0, 0, 0, 0, 5, 10, 10, 2, 10 ) ) );
		
		List<InteractiveSkill> suinteractiveSkills = new ArrayList<InteractiveSkill>();
		List<PassiveSkill> supassiveSkills = new ArrayList<PassiveSkill>();
		
		supassiveSkills.add(new PassiveSkill("Staff", 1));
		supassiveSkills.add(new PassiveSkill("Bane", 1));
		supassiveSkills.add(new PassiveSkill("Boon", 1));
		supassiveSkills.add(new PassiveSkill("Enchantment", 1));
		supassiveSkills.add(new PassiveSkill("Observation", 1));
		supassiveSkills.add(new PassiveSkill("Bargain", 1));
		
		List<ActiveSkill> suactiveSkills = new ArrayList<ActiveSkill>();
		
		library.put("Summoner", 
				new Occupation("Summoner", suinteractiveSkills, supassiveSkills , suactiveSkills, 
						new Stats(0, 0, 0, 0, 2, 10, 10, 5, 7 ) ) );
	}
	
	public static void addToLibrary(Occupation elem, String name)
	{
		if(!library.containsKey(name))
		{
			library.put(name, elem);
			numOccupations++;
		}
	}
	
	/**
	 * This method assumes you filter your removals prior to calling this method. 
	 */
	public static Occupation removeOccupationFromLibrary(String name)
	{
		Occupation elem = library.remove(name);
		numOccupations--;
		return elem;
	}
	
	public static Occupation getFromLibrary(String name)
	{
		return library.get(name);
	}
}
